window.onload = function() {
    let input1 = document.querySelector('.block2 .input1');
    let input2 = document.querySelector('.block2 .input2');
    input1.onfocus = function() {
        let value = input1.value;
        if (localStorage.getItem('usersname', value)) {
            input1.value = localStorage.getItem('usersname', value);
        } else {
            input1.value = '';
        }
    }
    input1.onblur = function() {
        let value = input1.value;
        localStorage.setItem('usersname', value);
        if (value == '') {
            input1.value = '请输入您的卡号';
        } else {
            input1.value = value;
        }
    }
    input2.onfocus = function() {
        let value2 = input2.value;
        if (localStorage.getItem('password', value2)) {
            input2.type = 'password';
            input2.value = localStorage.getItem('password', value2)
        } else {
            input2.value = '';
        }
    }
    input2.onblur = function() {
        let value2 = input2.value;
        localStorage.setItem('password', value2);
        if (value2 == '') {
            input2.type = 'text';
            input2.value = '请输入您的密码';
        } else {
            input2.value = value2;
        }
    }
}